package com.local.webservice.service.impl;

import com.local.webservice.model.Role;
import com.local.webservice.model.User;
import com.local.webservice.service.HelloWorld;

import javax.jws.WebService;
import java.util.ArrayList;
import java.util.List;

/**
 * @author lou ke
 * @version 1.0
 * @since 2020/5/8 14:20
 */
@WebService
public class HelloWorldImpl implements HelloWorld {
    public String say(String str) {
        return "hello" + str;
    }

    public List<Role> getRoleByUser(User user) {
        List<Role> roleList = new ArrayList<Role>();

        if (user != null) {
            if (user.getName().equals("admin") && user.getPassword().equals("123")) {
                roleList.add(new Role(1, "AdminRole"));
                roleList.add(new Role(2, "DbRole"));
            }
            return roleList;
        } else {
            return null;
        }
    }
}
